Skip to content

Sentry: ignore logging known exceptions #8919

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 14, 2022

Conversation

humitos
Copy link
Member

@humitos humitos commented Feb 14, 2022

By reading
https://docs.sentry.io/clients/python/integrations/#additional-settings it seems
that we should be able to ignore known exceptions to be sent to Sentry. Note
that we have this setting already defined at

SENTRY_CELERY_IGNORE_EXPECTED = True

However, we need to add these known exceptions to

throws = (
DuplicatedBuildError,
ProjectBuildsSkippedError,
ConfigError,
YAMLParseError,
)

This commit adds the known exceptions to be ignored by Celery and not sent to
Sentry either.

Closes #8902

@humitos humitos requested a review from a team as a code owner February 14, 2022 22:31
# ``SENTRY_CELERY_IGNORE_EXPECTED=True``.
#
# All exceptions generated by a user miss-configuration should be listed
# here. Actually, every subclass of ``BuildUserError``.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this future proof too? Like, any subclasses of BuildUserError are already included here with the superclass in the throws list?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is 100% clear to me. Sentry docs does not specify if indicating the superclass is enough to avoid sending their subclasses as an error as well. So, I'm specifying all of them for now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, not sure if there is a good way to test it. However, we want all BuildUserError to not be reported to Sentry because we know it's not our fault. The "problem" is that we need to specify all the classes here, which may be a little tedious, but that's fine, I guess.

By reading
https://docs.sentry.io/clients/python/integrations/#additional-settings it seems
that we should be able to ignore known exceptions to be sent to Sentry. Note
that we have this setting already defined at
https://github.com/readthedocs/readthedocs.org/blob/b5908b0fc65cb02fc840b23eeb4218b3115b6590/readthedocs/settings/base.py#L453

However, we need to add these known exceptions to
https://github.com/readthedocs/readthedocs.org/blob/b5908b0fc65cb02fc840b23eeb4218b3115b6590/readthedocs/projects/tasks/builds.py#L224-L229

This commit adds the known exceptions to be ignored by Celery and not sent to
Sentry either.
@humitos humitos force-pushed the humitos/sentry-ignore-known-exceptions branch from e9c5829 to 00ea990 Compare February 14, 2022 22:36
@humitos humitos enabled auto-merge February 14, 2022 22:41
@humitos humitos merged commit c74bdbe into master Feb 14, 2022
@humitos humitos deleted the humitos/sentry-ignore-known-exceptions branch February 14, 2022 23:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Logging: filter Sentry user build errors
2 participants